home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
NOVA - For the NeXT Workstation
/
NOVA - For the NeXT Workstation.iso
/
Documents
/
NeXTAnswers
/
objc.516
< prev
next >
Wrap
Text File
|
1992-02-06
|
1KB
|
64 lines
{\rtf0\ansi{\fonttbl\f1\fswiss Helvetica;\f0\fmodern Courier;\f3\fnil Times-Roman;}
\paperw11440
\paperh6000
\margl120
\margr120
\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f1\b0\i0\ul0\fs24 compiler strong typing causes circular references\
\
Q: I like to use strong typing in my applications but this sometimes causes problems. For example, take
\b Bagel.h
\b0 \
\
\f0 #import <objc/Object.h>\
#import "Mold.h"\
\
@interface Bagel:Object\
\{\
Mold *someMold;\
\}\
@end\
\f1 \
and
\b Mold.h
\b0 \
\
\f0 #import <objc/Object.h>\
#import "Bagel.h"\
\
@interface Mold:Object\
\{\
Bagel *aBagel;\
\}\
@end\
\f1 \
The compiler doesn't like the circular reference my strong typing causes. What can I do?\
\
\
A: There's no elegant way to avoid this problem. Modifying
\b Mold.h
\b0 to look like the following will remove the problem:\
\
\f0 #import <objc/Object.h>\
#import "Bagel.h"\
\
@interface Mold : Object\
\{\
\b struct
\b0 Bagel *aBagel;\
\}\
@end\
\f1 \
Valid for 1.0\
Valid for 2.0\
\
QA516 \
\